Method: Truck::Autoloader#<<
- Defined in:
- lib/truck/autoloader.rb
#<<(const_name) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/truck/autoloader.rb', line 13 def <<(const_name) raise_name_error!(const_name) unless context @dir_paths = each_possible_const(const_name).reduce [] do |new_paths, possible_const| resolved_const = context.resolve_const possible_const throw :const, resolved_const if resolved_const new_paths << possible_const if possible_namespace?(possible_const) new_paths end raise_name_error!(const_name) if dir_paths.empty? end |